#!/bin/bash

for filename in S*.nii.gz
do

echo  ${filename}

# This scripts requires NORDIC_wrapper_noise.m ./
#Which has been developed by Lasse Knusen and is available here:

# This scripts requires NIFTI_NORDIC.m ./
#which can be obtained from here:

#matlab is an alias to the matlab binary
# you midgt find it at a location like this: /Applications/MATLAB_R2024a.app/bin/matlab
/Applications/MATLAB_R2024a.app/bin/matlab -nodesktop -nosplash -r  "NORDIC_wrapper_noise ${filename}"

# renaming file to original in case this is expected by following scripts
# make sure that you are working on a copy of the original data, as this will overwrite the file
mv NORDIC_${filename}.nii.gz ${filename}

done
